package com.unam.agenda;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class Database extends SQLiteOpenHelper {

	private static final String BD_NAME="Agenda";
	private static final int BD_VERSION=1;
	private static String crearTabla="CREATE TABLE contacto"+" (codigo INTEGER PRIMARY KEY AUTOINCREMENT, "+
									" nombre TEXT NOT NULL, telefono TEXT NOT NULL UNIQUE);";
	
	public Database(Context context) {
		super(context, BD_NAME, null, BD_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		// TODO Auto-generated method stub
		arg0.execSQL(crearTabla);

	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		arg0.execSQL("DROP TABLE IF EXISTS contacto");
		arg0.execSQL(crearTabla);
	}

}
